CC = gcc
AS = nasm
CFLAGS = -Wall -g
ASFLAGS = -t -g -f coff
OBJS_CC = video-text.o video-graphics.o utility.o matrix_algorithms.o timer.o speaker.o int.o kbc.o rtc.o gqueue.o codepage.o highscores.o
OBJS_AS = timer0.o kbd_isr_mouse_isr.o
EXTRAH = utypes.h parameters.h
MAINFILE = bubblecraft.c
OUTFILE = bcraft.exe

all: $(OUTFILE)

$(OUTFILE): $(MAINFILE) $(EXTRAH) $(OBJS_CC) $(OBJS_AS)
	@echo Linking files ...
	@$(CC) $(CFLAGS) $(MAINFILE) $(OBJS_CC) $(OBJS_AS) kbc_init.o -o $(OUTFILE)
	@echo Program ready to execute
	
%.o: %.c %.h
	@echo Compiling $< ...
	@$(CC) $(CFLAGS) -c $<
	@echo done

%.o: %.asm
	@echo Assembling $< ...
	@$(AS) $(ASFLAGS) $<
	@echo done

clean:
	@echo Cleaning up ...
	@rm -f $(OBJS_CC) $(OBJS_AS) $(OUTFILE)
	@echo done

rebuild: clean all
